package com.cqjtu.tto.vo;

import com.cqjtu.tto.dao.pojo.Salary;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
public class SalaryVo {
    /**
     * 工资id
     */
    @ApiModelProperty(value = "工资id")
    private Long salaryId;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    private Long userId;

    /**
     * 员工姓名
     */
    @ApiModelProperty(value = "员工姓名")
    private String name;

    /**
     * 工资生成时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty(value = "工资生成时间")
    private LocalDateTime salaryCreat;

    /**
     * 基本工资
     */
    @ApiModelProperty(value = "基本工资")
    private BigDecimal baseSalary;

    /**
     * 绩效工资
     */
    @ApiModelProperty(value = "绩效工资")
    private BigDecimal performanceSalary;

    /**
     * 总工资
     */
    @ApiModelProperty(value = "总工资")
    private BigDecimal totalSalary;

    public SalaryVo(Salary salary, String name){
        this.salaryId = salary.getSalaryId();
        this.userId = salary.getUserId();
        this.name = name;
        this.salaryCreat = salary.getSalaryCreat();
        this.baseSalary = salary.getBaseSalary();
        this.performanceSalary = salary.getPerformanceSalary();
        this.totalSalary = salary.getBaseSalary().add(salary.getPerformanceSalary());
    }
}
